 var uid = sessionStorage.getItem("u_group_no");
 $(function () {
	 var request = "";
	 
	/* 获取type */
	var take_type = "";
	request = GetRequest();
	take_type = request['type'];

	if(take_type !== undefined){
		/* $("#category_select option[value="+ take_type +"]").attr("selected", true); */
		$(" select option[value='"+take_type+"']").attr("selected","selected"); 
		var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "indent_status" : 1, "take_type": take_type, "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
		ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
		
	}else{
		var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "uid": uid, "indent_status" : 1, "bdate": "", "edate":"", "rand": Math.random() };
		ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
	}
	 
	 
	 /* 获取订单类别的点击事件 */
	$("#category_select").on("change", function(){
		//订单类别
	 	var take_type = $(this).children('option:selected').val(); 
		if(take_type !== "0"){
			var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "indent_status" : 1, "take_type": take_type, "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
			ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
		}else{
			var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "indent_status" : 1, "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
			ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
		}
	 });
  /*  var paramJson = { "actName": "GetIndentM", "rows": "10", "page": 1, "utype": "5", "take_type": 0, "uid": 201000, "bdate": "", "edate":"", "rand": Math.random() };
    ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
	 */
	/* 订单列表详情点击 */
	$("#shop_medicine_list").on("click", ".order-details", function(){
		var prescription_id = $(this).attr("data-Pid");
		var indent_no = $(this).attr("data-Iid")
		window.location.href = "shop_order_details.html?prescription_id=" + prescription_id + "&indent_no=" + indent_no
	});
	
});

/* 获取处方信息 */
function doOk(rstData) {
	if (rstData.code === "1" && rstData.list.length > 0) {
		//生成html片段
		var html = template("shopMedicineList",rstData);
		var container = document.getElementById("shop_medicine_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
	else{
		//生成html片段
		var html = template("noData",rstData);
		var container = document.getElementById("shop_medicine_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
}